﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Cfg;
using System.Reflection;

namespace OA.BLL.DB_help
{
    public class ShowSql : EmptyInterceptor
    {
        public override NHibernate.SqlCommand.SqlString OnPrepareStatement(NHibernate.SqlCommand.SqlString sql)
        {
            if ( BLL.SystemConfig.LoadConfig().Feature.IsLogHQL)
            {
                var logstr = System.Web.HttpContext.Current.Items[Common.Keys.LogHqlKey];
                logstr += sql + "\r\n";
                System.Web.HttpContext.Current.Items[Common.Keys.LogHqlKey] = logstr;
            }
            return base.OnPrepareStatement(sql);
        }
    }
}
